package game;

import java.net.Socket;
import java.util.ArrayList;

import paintball.PaintballPlayer;

public class PlayerController {
	private static ArrayList<PaintballPlayer> players = new ArrayList<PaintballPlayer>();
	
	public static void PlayerAction(String playerName, String action){
		Player p = getPlayer(playerName);
		if(p != null){
			//p.doAction();
		}
	}
	
	public static ArrayList<PaintballPlayer> getPlayers(){
		return players;
	}
	
	public static Player addPlayer(String playerName, int x, int y, Socket s){
		PaintballPlayer p = new PaintballPlayer(x, y, playerName, s);
		p.setRotation(Math.random()*360);
		players.add(p);
		return p;
	}
	
	public static void removePlayer(PaintballPlayer player){
		players.remove(player);
	}
	
	public static Player getPlayer(String playerName){
		for(PaintballPlayer p: players){
			if(p.getPlayerName().equalsIgnoreCase(playerName)){
				return p;
			}
		}
		return null;
	}
}
